<?php
declare(strict_types=1);
namespace App\Controller\Notify;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use Service\DeclareService\PayDeclareCompany\Hnapay as HnapyDeclare;
use Hyperf\Di\Annotation\Inject;

/**
 * 支付单申报接口回调
 * 
 * @Controller(prefix="/paydeclare/notify")
 */
class PayDeclareController extends AbstractController
{
    /**
     * @Inject()
     * @var HnapyDeclare
     */
    protected $hnapyDeclare;
    
    /**
     * 回调接口地址
     * @RequestMapping(path="hnapay", methods="post")
     */
    public function hnapaynotify(RequestInterface $request,ResponseInterface $response)
    {
        $this->hnapyDeclare->notify($request->getParsedBody());
        return $response->raw('success');
    }
}